home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / sox / handlers.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  7KB  |  260 lines

  1. /*
  2.  * July 5, 1991
  3.  * Copyright 1991 Lance Norskog And Sundry Contributors
  4.  * This source code is freely redistributable and may be used for
  5.  * any purpose.  This copyright notice must be maintained. 
  6.  * Lance Norskog And Sundry Contributors are not responsible for 
  7.  * the consequences of using this software.
  8.  */
  9.  
  10. #include "st.h"
  11.  
  12. /*
  13.  * Sound Tools file format and effect tables.
  14.  */
  15.  
  16. /* File format handlers. */
  17.  
  18. char *rawnames[] = {
  19.     "raw",
  20. /*?    "sou", /* */
  21.     (char *) 0
  22. };
  23. extern rawstartread(), rawread();
  24. extern rawstartwrite(), rawwrite(), rawstopwrite();
  25.  
  26. char *vocnames[] = {
  27.     "voc",
  28.     (char *) 0
  29. };
  30. extern vocstartread(), vocread(), vocstopread();
  31. extern vocstartwrite(), vocwrite(), vocstopwrite();
  32.  
  33. char *aunames[] = {
  34.     "au",
  35. #ifdef    NeXT
  36.     "snd",
  37. #endif
  38.     (char *) 0
  39. };
  40. extern austartread();
  41. extern austartwrite(), auwrite(), austopwrite();
  42.  
  43. char *aiffnames[] = {
  44.     "aiff",
  45.     "aif",
  46.     (char *) 0
  47. };
  48. extern aiffstartread(), aiffread(), aiffstopread();
  49. extern aiffstartwrite(), aiffwrite(), aiffstopwrite();
  50.  
  51. char *svxnames[] = {
  52.     "8svx",
  53.     "iff",
  54.     (char *) 0
  55. };
  56. extern svxstartread(), svxread(), svxstopread();
  57. extern svxstartwrite(), svxwrite(), svxstopwrite();
  58.  
  59. char *hcomnames[] = {
  60.     "hcom",
  61.     (char *) 0
  62. };
  63. extern hcomstartread(), hcomread(), hcomstopread();
  64. extern hcomstartwrite(), hcomwrite(), hcomstopwrite();
  65.  
  66. char *sndtnames[] = {
  67.     "sndt",
  68. #ifdef    DOS
  69.     "snd",
  70. #endif
  71.     (char *) 0
  72. }; 
  73. extern sndtstartread();
  74. extern sndtstartwrite(), sndtwrite(), sndtstopwrite();
  75.  
  76. char *sndrnames[] = {
  77.     "sndr",
  78.     (char *) 0
  79. };
  80. extern sndrstartwrite();
  81.  
  82. char *ubnames[] = {
  83.     "ub",
  84.     "sou",
  85.     "fssd",
  86. #ifdef    MAC
  87.     "snd",
  88. #endif
  89.     (char *) 0
  90. };
  91. extern ubstartread();
  92. extern ubstartwrite();
  93.  
  94. char *sbnames[] = {
  95.     "sb",
  96.     (char *) 0
  97. };
  98. extern sbstartread();
  99. extern sbstartwrite();
  100.  
  101. char *uwnames[] = {
  102.     "uw",
  103.     (char *) 0
  104. };
  105. extern uwstartread();
  106. extern uwstartwrite();
  107.  
  108. char *swnames[] = {
  109.     "sw",
  110.     (char *) 0
  111. };
  112. extern swstartread();
  113. extern swstartwrite();
  114.  
  115. char *ulnames[] = {
  116.     "ul",
  117.     (char *) 0
  118. };
  119. extern ulstartread();
  120. extern ulstartwrite();
  121.  
  122.  
  123. char *sfnames[] = {
  124.     "sf",
  125.     (char *) 0
  126. };
  127. extern sfstartread();
  128. extern sfstartwrite();
  129.  
  130. char *wavnames[] = {
  131.     "wav",
  132.     (char *) 0
  133. };
  134. extern wavstartread(), wavread();
  135. extern wavstartwrite(), wavwrite(), wavstopwrite();
  136.  
  137. #if    defined(BLASTER) || defined(SBLAST)
  138. char *sbdspnames[] = {
  139.     "sbdsp",
  140.     (char *) 0
  141. };
  142. extern sbdspstartread(), sbdspread(), sbdspstopread();
  143. extern sbdspstartwrite(), sbdspwrite(), sbdspstopwrite();
  144. #endif
  145.  
  146. char *smpnames[] = {
  147.     "smp",
  148.     (char *) 0,
  149. };
  150.  
  151. extern smpstartread(), smpread(), smpwrite();
  152. extern smpstartwrite(), smpstopwrite();
  153.  
  154. char *autonames[] = {
  155.     "auto",
  156.     (char *) 0,
  157. };
  158.  
  159. extern autostartread();
  160. extern autostartwrite();
  161.  
  162. extern nothing();
  163.  
  164. EXPORT format_t formats[] = {
  165.     {autonames, autostartread, nothing, nothing,    /* Guess from header */
  166.         autostartwrite, nothing, nothing},    /* patched run time */
  167.     {smpnames, smpstartread, smpread, nothing,    /* SampleVision sound */
  168.         smpstartwrite, smpwrite, smpstopwrite},    /* Turtle Beach */
  169.     {rawnames, rawstartread, rawread, nothing,     /* Raw format */
  170.         rawstartwrite, rawwrite, nothing},
  171.     {vocnames, vocstartread, vocread, vocstopread,  /* Sound Blaster .VOC */
  172.         vocstartwrite, vocwrite, vocstopwrite},
  173.     {aunames, austartread, rawread, nothing,     /* SPARC .AU w/header */
  174.         austartwrite, auwrite, austopwrite},    
  175.     {ubnames, ubstartread, rawread, nothing,     /* unsigned byte raw */
  176.         ubstartwrite, rawwrite, nothing},    /* Relies on raw */
  177.     {sbnames, sbstartread, rawread, nothing,     /* signed byte raw */
  178.         sbstartwrite, rawwrite, nothing},    
  179.     {uwnames, uwstartread, rawread, nothing,     /* unsigned word raw */
  180.         uwstartwrite, rawwrite, nothing},    
  181.     {swnames, swstartread, rawread, nothing,     /* signed word raw */
  182.         swstartwrite, rawwrite, nothing},
  183.     {ulnames, ulstartread, rawread, nothing,     /* u-law byte raw */
  184.         ulstartwrite, rawwrite, nothing},    
  185.     {aiffnames, aiffstartread, rawread, nothing,    /* SGI/Apple AIFF */
  186.         aiffstartwrite, aiffwrite, aiffstopwrite},
  187.     {svxnames, svxstartread, svxread, svxstopread,      /* Amiga 8SVX */
  188.         svxstartwrite, svxwrite, svxstopwrite},
  189.     {hcomnames, hcomstartread, hcomread, hcomstopread, /* Mac FSSD/HCOM */
  190.         hcomstartwrite, hcomwrite, hcomstopwrite},
  191.     {sfnames, sfstartread, rawread, nothing,     /* IRCAM Sound File */
  192.         sfstartwrite, rawwrite, nothing},    /* Relies on raw */
  193.     {sndtnames, sndtstartread, rawread, nothing,    /* Sndtool Sound File */
  194.         sndtstartwrite, sndtwrite, sndtstopwrite},
  195.     {sndrnames, sndtstartread, rawread, nothing,    /* Sounder Sound File */
  196.         sndrstartwrite, rawwrite, nothing},
  197.     {wavnames, wavstartread, wavread, nothing,     /* Windows 3.0 .wav */
  198.         wavstartwrite, wavwrite, wavstopwrite},    
  199. #if    defined(BLASTER) || defined(SBLAST)
  200.     /* 386 Unix sound blaster players.  No more of these, please! */
  201.     {sbdspnames, sbdspstartread, sbdspread, sbdspstopread,     /* /dev/sbdsp */
  202.         sbdspstartwrite, sbdspwrite, sbdspstopwrite},    
  203. #endif
  204.     0
  205. };
  206.  
  207. /* Effects handlers. */
  208.  
  209. extern null_drain();        /* dummy drain routine */
  210.  
  211. extern copy_getopts(), copy_start(), copy_flow(), copy_stop();
  212. extern avg_getopts(), avg_start(), avg_flow(), avg_stop();
  213. extern pred_getopts(), pred_start(), pred_flow(), pred_stop();
  214. extern stat_getopts(), stat_start(), stat_flow(), stat_stop();
  215. extern vibro_getopts(), vibro_start(), vibro_flow(), vibro_stop();
  216. extern band_getopts(), band_start(), band_flow(), band_stop();
  217. extern lowp_getopts(), lowp_start(), lowp_flow(), lowp_stop();
  218. extern highp_getopts(), highp_start(), highp_flow(), highp_stop();
  219. extern echo_getopts(), echo_start(), echo_flow(), echo_drain(), echo_stop();
  220. extern rate_getopts(), rate_start(), rate_flow(), rate_stop();
  221. extern reverse_getopts(), reverse_start(), 
  222.        reverse_flow(), reverse_drain(), reverse_stop();
  223.  
  224. /*
  225.  * EFF_CHAN means that the number of channels can change.
  226.  * EFF_RATE means that the sample rate can change.
  227.  * The first effect which can handle a data rate change, stereo->mono, etc.
  228.  * is the default handler for that problem.
  229.  * 
  230.  * EFF_MCHAN just means that the effect is coded for multiple channels.
  231.  */
  232.  
  233. EXPORT effect_t effects[] = {
  234.     {"copy", EFF_MCHAN, 
  235.         copy_getopts, copy_start, copy_flow, null_drain, nothing},
  236.     {"avg", EFF_CHAN, 
  237.         avg_getopts, avg_start, avg_flow, null_drain, avg_stop},
  238.     {"pred", 0,
  239.         pred_getopts, pred_start, pred_flow, null_drain, pred_stop},
  240.     {"stat", EFF_MCHAN, 
  241.         stat_getopts, stat_start, stat_flow, null_drain, stat_stop},
  242.     {"vibro", 0, 
  243.         vibro_getopts, vibro_start, vibro_flow, null_drain, nothing},
  244.     {"echo", 0, 
  245.         echo_getopts, echo_start, echo_flow, echo_drain, echo_stop},
  246.     {"band", 0, 
  247.         band_getopts, band_start, band_flow, null_drain, band_stop},
  248.     {"lowp", 0, 
  249.         lowp_getopts, lowp_start, lowp_flow, null_drain, lowp_stop},
  250.     {"highp", 0, 
  251.         highp_getopts, highp_start, highp_flow, null_drain, highp_stop},
  252.     {"rate", EFF_RATE, 
  253.         rate_getopts, rate_start, rate_flow, null_drain, nothing},
  254.     {"reverse", 0, 
  255.         reverse_getopts, reverse_start, 
  256.         reverse_flow, reverse_drain, reverse_stop},
  257.     0
  258. };
  259.  
  260.